package com.hue;

import com.hue.config.RabbitMQConfig;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

@SpringBootTest
@RunWith(SpringRunner.class)
public class RabbitmqTemplate {
    @Autowired
    private RabbitTemplate rabbitTemplate;

    @Test
    public void test1(){
        //发送两条消息
        rabbitTemplate.convertAndSend(RabbitMQConfig.EXCHANGE_NAME,"user.select","user select");
        rabbitTemplate.convertAndSend(RabbitMQConfig.EXCHANGE_NAME,"user.add","user add");
    }
}
